@ECHO OFF
:START
ECHO start option .......

@REM FOR /f "tokens=2 delims==" %%I IN ('wmic os get localdatetime /value') DO SET datetime=%%I
@REM SET localdate=%datetime:~0,4%-%datetime:~4,2%-%datetime:~6,2%
@REM SET datetime=%datetime:~0,4%-%datetime:~4,2%-%datetime:~6,2%-%datetime:~8,2%:%datetime:~10,2%:%datetime:~12,2%
@REM echo Current Time: %datetime%

SET yyyy=%date:~,4%
SET mm=%date:~5,2%
SET day=%date:~8,2%
SET CurrentDate=%yyyy%-%mm%-%day%
ECHO CurrentDate: %CurrentDate%

SET PATH1=BAK\%yyyy%-%mm%-%day%
SET PATH2=BAK\%yyyy%-%mm%-%day%

IF EXIST "%PATH1%" (
    ECHO ................ FOLDER EXIST ................
) ELSE (
    ECHO  ................ FOLDER NOT EXIST ................
    MD %PATH1%
    ECHO  ................ MKDIR FOLDER OK ................
)
ECHO ................ START BACKUP YB04D DB ................
pg_dump -h 127.0.0.1 -p 5432 -U postgres -F c -b -v -f %PATH2%/visuautotec.dump visuautotec
ECHO ................ FINISH BACKUP YB04D DB ................
GOTO end
:END


